begintownscript;
variables;
short choice,i,j;

body;
beginstate init_state;
i = 0;
while(char_ok(i) == 0){
	i = i + 1;
}
j = 6;
while(j < 33){
	set_mobility(j,0);
	j = j + 1;
}
set_name(31,"???");
set_name(30,"Jerald");
reset_dialog();
add_dialog_str(0,"Before I could get another word in, Jerald had me by the wrist and was leading me through a maze of alleys and back roads. He knew his way around Cigosal, I'll give him that.",0);
add_dialog_str(1,"Eventually we reached an inn down by the waterfront. _The innkeeper is a friend of the Banner, we can hide out here. Headquarters isn't far, but we should make sure the coast is completely clear before we head there._",0);
add_dialog_str(2,"_We don't want to lead the guards there._",0);
add_dialog_choice(0,"Yeah, sure.");
run_dialog(1);
relocate_character(i,32,32);
set_character_pose(i,6);
force_view_center(32,32);
force_instant_terrain_redraw();
pause(1);
message_dialog("The Spray was like any other waterfront dive. There were a few shady characters lounging about, but the rest were mostly sailors and derelicts, standard waterfront folk.","Jerald picked a table in the far corner and led me there.");
reset_dialog();
add_dialog_str(0,"He called for a pitcher of beer, which I didn't touch. I'd been in jail for five years with nothing but water and mush but I still had higher standards.",0);
add_dialog_str(1,"We sat in silence for a while. Jerald was clearly in awe of the 'legendary figure' across from him. Occasionally he would start talking about something related to this organization I was apparently supposed to be a part of-- the Azure Banner.",0);
add_dialog_str(2,"I would nod and occasionally grunt noncommittally, not wanting to reveal my ignorance. It went on that way for almost an hour.",0);
add_dialog_choice(0,"OK");
choice = run_dialog(1);
break;

beginstate exit_state;
break;

beginstate start_state;
if(get_flag(16,0) == 1)
	set_state_continue(10);
if(get_flag(16,0) == 0)
	inc_flag(16,0,1);
if(get_flag(16,2) == 1)
	set_state_continue(14);
break;

beginstate 10;
if(get_flag(16,0) == 1){
	set_flag(16,0,2);
	block_entry(1);
	reset_dialog();
	add_dialog_str(0,"My mind was racing for ways I might get out of this. I couldn't go back to this headquarters-- someone there would realize I wasn't Durant and they doubtless wouldn't be pleased.",0);
	add_dialog_str(1,"I wondered if Jerald would pursue me into the streets if I made a break for it. If he did he could catch me easily, he looked to be in good shape, and I decided I couldn't risk running through the streets and attracting the guards' attention.",0);
	add_dialog_str(2,"I let my eyes roam across the room, looking for some way to get out of this bind. They froze as they crossed the front door, where a man stood that I couldn't be less happy to see.",0);
	add_dialog_choice(0,"OK");
	choice = run_dialog(1);
	force_view_center(25,39);
	set_total_visibility(1);
	force_instant_terrain_redraw();
	pause(10);
	message_dialog("An old acquaintance of mine stood in the doorway. It had been going on seven years since I'd last seen him, but I'd have recognized him anywhere. His name was Christopher Sly.","I dropped my head the moment I saw him, hoping he hadn't seen me. I tentatively peaked up to find him craning his head in my direction, trying to see if it was really me. He'd spotted me.");
	reset_dialog();
	add_dialog_str(0,"_....so that was a year ago. I joined the Azure Banner the next day-- I wanted to finally stand up to Gromwell and his thugs. I'd heard about your work in Cascadaca, and when I heard what the Banner was planning I was immediately...._",0);
	add_dialog_str(1,"Jerald had finally worked up the courage to speak to his idol. I hadn't been paying attention-- and now I had to cut him off.",0);
	add_dialog_choice(0,"We need to get out of here-- is there a back exit?");
	choice = run_dialog(1);
	reset_dialog();
	add_dialog_str(0,"_Is there a back entrance-- why, are we in danger? No, no, never mind I'll trust your judgment. This was a foolish idea-- the Spray isn't safe. Nowhere but headquarters is safe._",0);
	add_dialog_str(1,"_There is a back exit to the west, before the stairs. It opens on an alley. There is a secret passage there in the north wall, it will take us to the docking district. In case we get separated, the new headquarters is at Warehouse G.",0);
	add_dialog_str(2,"Sly was looking our way, and beginning to approach. He would surely ruin my cover if he came over.",0);
	add_dialog_choice(0,"Alright alright, let's go already.");
	choice = run_dialog(1);
	message_dialog("_Sorry. This way, follow me._","");
	set_total_visibility(0);
	set_mobility(30,1);
	add_char_to_party(30);
	force_view_center(32,32);
	set_character_pose(i,0);
	force_instant_terrain_redraw();
}
break;

beginstate 11;
block_entry(1);
print_str("Not that way.");
break;

beginstate 12;
if(get_flag(16,1) == 0){
	message_dialog("_Emery!_","The exit was in sight. Just a little bit further.");
	set_flag(16,1,1);
}
break;

beginstate 13;
if(get_flag(16,3) > 0)
	end();
erase_char(4);
block_entry(1);
message_dialog("Once I was clear of the inn, I broke into a headlong sprint, no longer worried about attracting unwanted attention. I heard the door burst open behind me, and a moment later I felt a hand grab me by the shoulder.","");
activate_hidden_group(1);
relocate_character(i,16,27);
set_character_facing(i,2);
force_instant_terrain_redraw();
set_name(7,"Sly");
set_char_dialogue_pic(7,300,0);
set_flag(16,3,1);
break;

beginstate 14;
message_dialog("I didn't have a lot of choice in the matter, though. Hopefully I wouldn't botch it too bad.","I prepared a stun spell as I turned to face Jerald.");
set_character_pose(6,2);
set_character_facing(i,4);
set_character_pose(i,2);
force_instant_terrain_redraw();

put_sparkles_on_char(i,3,10);
run_animation_sound(25);
pause(2);

activate_hidden_group(2);
put_sparkles_on_char(32,11,10);
run_animation_sound(163);
pause(1);

message_dialog("_Gotcha._","");

text_bubble_on_char(i,"!");
set_character_facing(i,2);
force_instant_terrain_redraw();
pause(1);

set_character_pose(i,1);
force_instant_terrain_redraw();
pause(1);

put_sparkles_on_char(7,8,10);
run_animation_sound(-65);
pause(1);

set_character_pose(7,11);
force_instant_terrain_redraw();
pause(1);

set_character_pose(7,12);
force_instant_terrain_redraw();
pause(1);

set_character_pose(7,13);
force_instant_terrain_redraw();
pause(1);

set_character_pose(7,14);
force_instant_terrain_redraw();
pause(1);

message_dialog("Out of the corner of my eye I saw a man materialize out of nowhere. And when I say nowhere, I literally mean nowhere. One second nobody is standing there, next second there's a man with a sword.","Now this obviously caught my attention. I whirled, mouth agape, to face this threat. I must have looked really stunned, because it prompted Sly to step forward to turn and see what was so shocking behind him.");
message_dialog("Unfortunately he bumped into me. It broke my focus-- I told you I was rusty-- and the spell intended for Jerald went off.","Sly crumpled to the ground, unconscious. Not at all what I had intended."); 

set_character_pose(32,1);
force_instant_terrain_redraw();
play_sound(69);
pause(1);
message_dialog("The assassin, for that's pretty much the only explanation I could come up with for a man who comes out of nowhere with a drawn weapon, swung his sword at Sly.","Or rather he swung his sword where Sly WAS standing-- by this time he was already halfway to the floor. The sword went whistling past harmlessly.");
message_dialog("Right into Jerald's breastplate.","");

set_character_pose(32,0);
text_bubble_on_char(i,"");
force_instant_terrain_redraw();
pause(2);
play_sound(48);
reset_dialog();
add_dialog_str(0,"Who swung right back with his halberd, sending the assassin rolling for cover. It looked like for the time both my threats were distracted.",0);
add_dialog_str(1,"Jerald had said there was a secret passage to the north. I started towards it, but halted and turned back.",0);
add_dialog_str(2,"Sly was lying on the ground, oblivious to the fight that was going on above him. He HAD been a friend of mine, and was a good fellow. I couldn't leave him lying there with those two-- at least one of whom definitely wanted him dead.",0);
add_dialog_str(3,"I rushed back to grab Sly by the arms and drag him towards the passage. The fight between the assassin and Jerald had moved to the west, where Jerald had drove the assassin back against the far wall of the alley.",0);
add_dialog_str(4,"It looked like they'd be busy for a while. I slipped through the passage.",0);
add_dialog_choice(0,"OK");
choice = run_dialog(1);
relocate_character(i,1,1);
set_flag(16,2,2);
break;

beginstate 15;
move_to_new_town(17,36,42);
break;

beginstate 100;
block_entry(1);
break;

beginstate 101;
block_entry(1);
if(get_flag(16,2) == 1)
	set_state_continue(14);
break;